package com.util.net
import java.sql.*;
import groovy.sql.Sql
class AccessDb {
	
	static main(args) {
		
		
		
		def strurl="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=db.mdb"
		
		
		Sql.loadDriver "sun.jdbc.odbc.JdbcOdbcDriver";
		
		println("before connection")
		def mysql=Sql.newInstance(strurl)
		
		mysql.execute "create table test(id int,name varchar(10),pwd varchar(10))"
		mysql.execute "insert into test values(1,'a','b')"
		mysql.execute "insert into test values(2,'b','c')"
		mysql.eachRow("select * from test"){println it.id}
		
		mysql.close()
	}
}
